package net.jlibrary.common.project.domain;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import net.jlibrary.common.core.annotation.CodeGenComment;
import net.jlibrary.common.core.annotation.SearchCondition;
import net.jlibrary.common.core.annotation.SearchField;
import net.jlibrary.common.core.entity.BaseObject;

/**
 * 常用搜索关键字
 * @author fzys
 *
 */
@Entity(name = "tab_incommonusesearch")
@CodeGenComment(value = "常用搜索关键字", genSelect=false,add = true, update = true, delete = true)
//@Compositor(value = "num desc,createdate desc")
public class InCommonUseSearch extends BaseObject {
	private static final long serialVersionUID = -7364324710247295173L;
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@SearchField(value = "id", condition = SearchCondition.EQUAL)
	private Long id;
	@Column(length = 200)
	@SearchField(value = "className", condition = SearchCondition.EQUAL)
	@CodeGenComment(value = "类名", viewList = false)
	private String className;//类名
	@Column(length = 50)
	@CodeGenComment(value = "模块描述", viewList = true)
	private String classDesc;//模块描述
	@Column(length = 50)
	@SearchField(value = "fieldName", condition = SearchCondition.EQUAL)
	@CodeGenComment(value = "列名", viewList = false)
	private String fieldName;//列名
	@Column(length = 50)
	@CodeGenComment(value = "列名描述", viewList = true)
	private String fieldDesc;//列名描述
	@Column(length = 200)
	@CodeGenComment(value = "关键字内容", viewList = true)
	private String keyContent;//关键字内容
	@CodeGenComment(value = "搜索次数", viewList = true)
	private int num;//搜索次数
	
	@Column(updatable = false)
	@Temporal(TemporalType.TIMESTAMP)
	@CodeGenComment(value = "创建时间", viewList = true)
	private Date createdate;
	@Temporal(TemporalType.TIMESTAMP)
	private Date lastdate;
	
	@Transient
	@SearchField(value = "keyContent", condition = SearchCondition.FUZZ_FULL)
	private String keyContentFuzzFullSearchKey;//列名描述
	@Transient
	@SearchField(value = "keyContent", condition = SearchCondition.EQUAL)
	private String keyContentlSearchKey;//列名描述
	public Long getId() {
		return id;
	}
	@Override
	public Serializable getPrimaryKey() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getClassName() {
		return className;
	}
	public void setClassName(String className) {
		this.className = className;
	}
	public String getClassDesc() {
		return classDesc;
	}
	public void setClassDesc(String classDesc) {
		this.classDesc = classDesc;
	}
	public String getFieldName() {
		return fieldName;
	}
	public void setFieldName(String fieldName) {
		this.fieldName = fieldName;
	}
	public String getFieldDesc() {
		return fieldDesc;
	}
	public void setFieldDesc(String fieldDesc) {
		this.fieldDesc = fieldDesc;
	}
	public String getKeyContent() {
		return keyContent;
	}
	public void setKeyContent(String keyContent) {
		this.keyContent = keyContent;
	}
	public int getNum() {
		return num;
	}
	public void setNum(int num) {
		this.num = num;
	}
	public Date getCreatedate() {
		return createdate;
	}
	public void setCreatedate(Date createdate) {
		this.createdate = createdate;
	}
	public Date getLastdate() {
		return lastdate;
	}
	public void setLastdate(Date lastdate) {
		this.lastdate = lastdate;
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		InCommonUseSearch other = (InCommonUseSearch) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}
	public String getKeyContentFuzzFullSearchKey() {
		return keyContentFuzzFullSearchKey;
	}
	public void setKeyContentFuzzFullSearchKey(String keyContentFuzzFullSearchKey) {
		this.keyContentFuzzFullSearchKey = keyContentFuzzFullSearchKey;
	}
	public String getKeyContentlSearchKey() {
		return keyContentlSearchKey;
	}
	public void setKeyContentlSearchKey(String keyContentlSearchKey) {
		this.keyContentlSearchKey = keyContentlSearchKey;
	}
}
